﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.IO;
using System.Web.UI.WebControls;
using System.Configuration;
using IPSWeb.Logic;
using PSWebLogic;

namespace IPSWeb
{
    public partial class GUI : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
            System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
            lblUsername.Text = p.Identity.Name;
            
            if (p.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
            {
                lblAdmin.Visible = true;
            }
            if (!PSConfigurationManager.IsScriptsFolderExists())
            {
                lblNoWritePremission.Visible = true;
            }
            if (PSUtil.IsPSV2())
            {
                lblVersion.Text = "2.0";
            }
            else
            {
                lblVersion.Text = "1.0";
            }
        }
        protected void btnCloseSession_Click(object sender, EventArgs e)
        {
            Session["psrunspace"] = null;
            Response.Redirect("default.aspx");
        }
    }
}
